﻿using System;
using WiMo.Games.Audio;
using System.Runtime.InteropServices;
using System.Threading;
using System.IO;

namespace WiMo.Games.StandardAudio
{
    public class GameAudio : IGameAudio
    {
        [DllImport("coredll.dll")]
        private extern static int PlaySoundW(String lpszName, int hModule, int dwFlags);

        private string fileName = string.Empty;

        public void Load(IContentManager contentManager, string name)
        {
            fileName = contentManager.GetFullPath(name);
        }

        public void Play()
        {
        //    new Thread(() =>
        //        { PlaySoundW(fileName, 0, 0); }).Start();
        }

        public void Pause()
        {
            throw new NotImplementedException();
        }

        public float Volume
        {
            get;
            set;
        }

        public void Stop()
        {
            throw new NotImplementedException();
        }

        public object AudioInformation { get; set; }

        public void Dispose()
        {
            var disposable = AudioInformation as IDisposable;
            if (disposable != null)
                disposable.Dispose();
        }
    }
}
